home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 August: Tool Chest / Dev.CD Aug 94.toast / Tool Chest / Interfaces / Universal Interfaces / CIncludes / CType.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-04-06  |  2.1 KB  |  82 lines  |  [TEXT/MPS ]

  1. /************************************************************
  2.  
  3.     ctype.h
  4.     Character handling
  5.     
  6.     Copyright American Telephone & Telegraph
  7.     Used with permission, Apple Computer Inc.    1985-1990, 1992, 1994.
  8.     All Rights Reserved.
  9.  
  10. ************************************************************/
  11.  
  12.  
  13. #ifndef __CTYPE__
  14. #define __CTYPE__
  15.  
  16. /*       @(#)ctype.h        2.1  */
  17. /*       3.0 SID #         1.2      */
  18. #define _U         01
  19. #define _L         02
  20. #define _N         04
  21. #define _S         010
  22. #define _P         020
  23. #define _C         040
  24. #define _B         0100
  25. #define _X         0200
  26.  
  27. extern char * const __p_CType;
  28.  
  29. #ifdef __cplusplus
  30. extern "C" {
  31. #endif
  32.  
  33. int isalnum (int c);
  34. #define isalnum(c)        ((__p_CType)[(unsigned char)(c)]&(_U|_L|_N))
  35. int isalpha (int c);
  36. #define isalpha(c)        ((__p_CType)[(unsigned char)(c)]&(_U|_L))
  37. int iscntrl (int c);
  38. #define iscntrl(c)        ((__p_CType)[(unsigned char)(c)]&_C)
  39. int isdigit (int c);
  40. #define isdigit(c)        ((__p_CType)[(unsigned char)(c)]&_N)
  41. int isgraph (int c);
  42. #define isgraph(c)        ((__p_CType)[(unsigned char)(c)]&(_P|_U|_L|_N))
  43. int islower (int c);
  44. #define islower(c)        ((__p_CType)[(unsigned char)(c)]&_L)
  45. int isprint (int c);
  46. #define isprint(c)        ((__p_CType)[(unsigned char)(c)]&(_P|_U|_L|_N|_B))
  47. int ispunct (int c);
  48. #define ispunct(c)        ((__p_CType)[(unsigned char)(c)]&_P)
  49. int isspace (int c);
  50. #define isspace(c)        ((__p_CType)[(unsigned char)(c)]&_S)
  51. int isupper (int c);
  52. #define isupper(c)        ((__p_CType)[(unsigned char)(c)]&_U)
  53. int isxdigit (int c);
  54. #define isxdigit(c)        ((__p_CType)[(unsigned char)(c)]&_X)
  55.  
  56. int tolower (int c);
  57. int toupper (int c);
  58.  
  59. /* Apple library extentions.  The prefered mechanism for enabling these is by defining
  60.  * __useAppleExts__.  In the absence of this symbol, the __STDC__ symbol is used to 
  61.  * enable or disable these extentions. */
  62.  
  63. #if defined (__useAppleExts__) || \
  64.     ((defined (applec) && ! defined (__STDC__)) || \
  65.      (defined (__PPCC__) && __STDC__ == 0))
  66.  
  67. int isascii (int c);
  68. #define isascii(c)        ( (unsigned int) (c) <= 0177)
  69.  
  70. #define __tolower(c)    ((c)-'A'+'a')
  71. #define __toupper(c)    ((c)-'a'+'A')
  72. int toascii (int c);
  73. #define toascii(c)        ((c)&0177)
  74.  
  75. #endif
  76.  
  77. #ifdef __cplusplus
  78. }
  79. #endif
  80.  
  81. #endif
  82.